package com.qianxun.framework.util.http;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public final class HttpRequest {
        // 请求地址
        private String url;
        private RequestMethod method;
        // 连接超时时间
        private Integer connectionTimeout;
        // 读取超时时间
        private Integer readTimeout;
        // 重定向
        private Boolean redirect;
        // 使用缓存
        private Boolean useCache;
        // 编码
        private String encode;
        // 请求头属性
        private Map<String, List<String>> headers = new HashMap<String, List<String>>(16);
        // 请求参数
        private Map<String, List<String>> parameters = new HashMap<String, List<String>>(16);
        // 参数字节数组,该参数不为空时,将不解析parameters字段的内容
        // 该属性的设置,主要为解决,某些加密后的数据,不能在转换为string类型
        private byte[] parameterConent;

        public HttpRequest(String url) {
            this.url = url;
        }

        public Integer getConnectionTimeout() {
            return connectionTimeout;
        }

        public void setConnectionTimeout(Integer connectionTimeout) {
            this.connectionTimeout = connectionTimeout;
        }

        public Integer getReadTimeout() {
            return readTimeout;
        }

        public void setReadTimeout(Integer readTimeout) {
            this.readTimeout = readTimeout;
        }

        public Boolean getRedirect() {
            return redirect;
        }

        public void setRedirect(Boolean redirect) {
            this.redirect = redirect;
        }

        public Boolean getUseCache() {
            return useCache;
        }

        public void setUseCache(Boolean useCache) {
            this.useCache = useCache;
        }

        public Map<String, List<String>> getHeaders() {
            return headers;
        }

        public Map<String, List<String>> getParameters() {
            return parameters;
        }

        public String getEncode() {
            return encode;
        }

        public void setEncode(String encode) {
            this.encode = encode;
        }

        public byte[] getParameterConent() {
            return parameterConent;
        }

        public void setParameterConent(byte[] parameterConent) {
            this.parameterConent = parameterConent;
        }

        public RequestMethod getMethod() {
            return method;
        }

        public void setMethod(RequestMethod method) {
            this.method = method;
        }

        public String getUrl() {
            return url;
        }
    }